/*
 * 创建日期 2005-12-12
 *
 * 更改所生成文件模板为
 * 窗口 > 首选项 > Java > 代码生成 > 代码和注释
 */
package com.vanda.report.dp;

import com.vanda.report.ReportException;
import com.vanda.report.ReportInnerData;
import com.vanda.report.Validation;
import com.vanda.report.element.BeanElement;
/**
 * @author wkf5985
 *
 * 更改所生成类型注释的模板为
 * 窗口 > 首选项 > Java > 代码生成 > 代码和注释
 */
public class ErrorElement extends BeanElement{
	private String message;
	public void validator() throws ReportException{
		Validation.checkRequired("ErrorElement","property",super.getProperty());
		Validation.checkRequired("ErrorElement","message",message);
	}
	
	/**
	 * 标签执行方法，递归执行

	 * @param obj
	 */
	public void execute(Object obj) throws ReportException{
		ReportInnerData reportData = (ReportInnerData)obj;
		String property = super.getProperty();
		
		try{
			Object contextObj = super.getNameObject(reportData);
			
			//重新设置属性值
			super.setProperty(contextObj,property,message);			
			
		}catch(ReportException e){
			throw e;
		}catch(Exception e){
			throw new ReportException(e);
		}

	}
	
	/**
	 * @return
	 */
	public String getMessage() {
		return message;
	}

	/**
	 * @param string
	 */
	public void setMessage(String string) {
		message = string;
	}

}
